package com.yuan.statemachine.business;

import com.yuan.statemachine.core.StateResponseBody;

/**
 * @author wjwei
 */
public class MessageBody extends StateResponseBody {

    public MessageBody() {
    }

    public MessageBody(BusinessStateCode stateCode) {
        this.setCode(stateCode.getCode());
        this.setMessage(stateCode.getMessage());
    }

    public static MessageBody stateDefault(BusinessStateCode stateCode) {
        return new MessageBody(stateCode);
    }

    public static MessageBody success(Object data) {
        MessageBody body = new MessageBody(BusinessStateCode.SUCCESS);
        body.setData(data);
        return body;
    }
}
